Repository navigation
fix(postgrest): fix scalar computed column type inference for isNotNullable and SETOF scalar - #2224
Merged
Merged
Conversation
@supabase/auth-js
@supabase/functions-js
@supabase/postgrest-js
@supabase/realtime-js
@supabase/storage-js
@supabase/supabase-js
commit: |
mandarini
force-pushed
the
fix/postgrest-scalar-type
branch
from
April 6, 2026 16:36
81f293e to
547351d
Compare
…llable and SETOF scalar
mandarini
force-pushed
the
fix/postgrest-scalar-type
branch
from
April 7, 2026 12:07
547351d to
b4b048f
Compare
grdsdev
approved these changes
Apr 7, 2026
This was referenced Apr 9, 2026
mandarini
pushed a commit
to supabase/supabase
that referenced
this pull request
Apr 9, 2026
This PR updates @supabase/*-js libraries to version 2.103.0. **Source**: supabase-js-stable-release **Changes**: - Updated @supabase/supabase-js to 2.103.0 - Updated @supabase/auth-js to 2.103.0 - Updated @supabase/realtime-js to 2.103.0 - Updated @supabase/postgest-js to 2.103.0 - Refreshed pnpm-lock.yaml --- ## Release Notes ## v2.103.0 ## 2.103.0 (2026-04-09) ### 🚀 Features - **postgrest:** add stripNulls method for null value stripping ([#2189](supabase/supabase-js#2189)) - **storage:** add cacheNonce parameter for download ([#2234](supabase/supabase-js#2234)) ### 🩹 Fixes - **postgrest:** fix scalar computed column type inference for isNotNullable and SETOF scalar ([#2224](supabase/supabase-js#2224)) ### ❤️ Thank You - Katerina Skroumpelou @mandarini - Seydi Charyyev @TheSeydiCharyyev - Vaibhav @7ttp This PR was created automatically. Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
mandarini
pushed a commit
to supabase/ssr
that referenced
this pull request
Apr 9, 2026
This PR updates `@supabase/supabase-js` to v2.103.0. **Source**: supabase-js-stable-release --- ## Release Notes ## v2.103.0 ## 2.103.0 (2026-04-09) ### 🚀 Features - **postgrest:** add stripNulls method for null value stripping ([#2189](supabase/supabase-js#2189)) - **storage:** add cacheNonce parameter for download ([#2234](supabase/supabase-js#2234)) ### 🩹 Fixes - **postgrest:** fix scalar computed column type inference for isNotNullable and SETOF scalar ([#2224](supabase/supabase-js#2224)) ### ❤️ Thank You - Katerina Skroumpelou @mandarini - Seydi Charyyev @TheSeydiCharyyev - Vaibhav @7ttp This PR was created automatically. Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
6 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
What changed?
Fixes two type inference bugs for scalar computed columns — PostgREST functions used as embedded fields in
.select()that return a primitive value instead of a table row. Also fixes a regression introduced during the fix where regular table embeds with empty parens (e.g.users()) were incorrectly added to the result type.Bug 1 — non-SETOF non-nullable scalar (
RETURNS bigint NOT NULL)When
SetofOptions.tois''(no target table),TablesAndViews<Schema>['']resolves tonever, soProcessNodesproduces{}instead of the correct primitive type (e.g.number).Bug 2 — SETOF scalar (
RETURNS SETOF uuid)Same root cause:
to: ''causes the table lookup to returnnever, so the final type resolves tonever[]instead ofstring[].Regression fix — empty-parens table embed (
users())While routing empty
()throughProcessEmbeddedResourceto handle scalar columns, regular table embeds with no fields selected (e.g.users()) were incorrectly gaining ausers: {}key in the result type. The prior behavior (no contribution to the result type) is now restored.Changes:
utils.ts:ResolveEmbededFunctionJoinTableRelationshipnow returns the fullGenericFunction(not justSetofOptions) soFn['Returns']is available downstream.ResolveForwardRelationshipbranches onSetofOptions['to'] extends '': scalar functions build a resolved object with ascalarTypeproperty set toFn['Returns']; table-valued functions use the existing logic unchanged.result.ts:ProcessFieldNoderoutes empty()throughProcessEmbeddedResourceinstead of immediately returning{}.ProcessEmbeddedResourcegains a scalar early-exit: if the resolved object hasscalarType, the primitive type is returned with correct nullability (ScalarTypeforisNotNullable: trueorisSetofReturn: true,ScalarType | nullotherwise). For regular table embeds with emptychildren,{}is returned to preserve prior behavior.test/types.generated.ts: two new scalar function fixtures (scalar_computed_countwithto: '',isNotNullable: true;scalar_computed_idswithto: '',isSetofReturn: true).test/embeded_functions_join.test.ts: type assertion tests verifyingscalar_computed_countresolves tonumberandscalar_computed_idsresolves tostring[].Why was this change needed?
Scalar computed columns were previously typed incorrectly: non-nullable scalars got
{}and SETOF scalars gotnever[]. This fix makes the SDK type-safe for scalar computed columns once the Supabase CLI generatesSetofOptionswithto: ''for these functions (a follow-up CLI change is needed).The fix is SDK-only. PostgREST returns correct data at runtime. Closes #1818
Screenshots/Examples
Before:
After:
Breaking changes
Checklist
<type>(<scope>): <description>npx nx formatto ensure consistent code formattingAdditional notes
The scalar computed column fix activates fully once the CLI generates
SetofOptionswithto: ''for scalar computed columns. Until then, the new code path is exercised only by the test fixtures added in this PR.